/*
 * Copyright © 2023 广州宏天软件股份有限公司 hotent
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hotent.project.auth.context;

import com.hotent.base.context.BaseContext;
import com.hotent.project.auth.util.ContextUtil;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * <pre>
 * 获取用户基本信息
 * </pre>
 *
 * @author: 黎扬贵
 * @date: 2023/6/20 下午4:00
 * @version: 1.0
 */
@Service
@Primary
public class AuthContext implements BaseContext {
    @Override
    public String getCurrentUserId() {
        return ContextUtil.getCurrentUserId();
    }

    @Override
    public String getCurrentUserAccout() {
        return Objects.requireNonNull(ContextUtil.getCurrentUser()).getAccount();
    }

    @Override
    public String getCurrentUserFullname() {
        return Objects.requireNonNull(ContextUtil.getCurrentUser()).getFullname();
    }

    @Override
    public String getCurrentOrgId() {
        return null;
    }

    @Override
    public String getCurrentTenantId() {
        return null;
    }

    @Override
    public void setTempTenantId(String s) {

    }

    @Override
    public void clearTempTenantId() {

    }

    @Override
    public boolean hasTempTenant() {
        return false;
    }
}
